<%@ page language="java" pageEncoding="UTF-8"
	import="com.yb.util.comm.RequestUtil,com.yb.domain.member.TsSysuser,com.yb.util.comm.Contants;"
	contentType="text/html; charset=utf-8"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
    <title>${tgBrand.name}-幸福兄弟-幸福兄弟拼购网-${pcategory.name}-${category.name}-商家会员</title>
	<meta name="description" content="幸福兄弟盐城拼购第一网www.9898sj.com是幸福兄弟营销策划有限公司旗下品牌项目。幸福兄弟盐城拼购第一网是专门针对建材、家具、电器进行同城拼购的一个网站。将全城千万消费者聚拢在一起，用量来获得最低的购买价格。网站聚集了全城1000个知名优质品牌，消费者足不出户就能完成对盐城建材、家具、电器市场进行最深刻的了解，通过拼购网购买是免费的，消费者不需要花一分钱就能实现最省钱、省心、舒心的购买。幸福兄弟盐城拼购第一网将帮助1000个优质品牌企业最大程度的宣传全城，帮助品牌企业好的口碑得到良好的传播，从而实现最好的销售。希望幸福兄弟盐城拼购第一网能为您的幸福生活、您的成功带来帮助！幸福生活，从拼购开始。公司地址，盐城市南城河路9号（迎宾桥北桥头东侧）；联系电话：0515-88175689  88175528"/>
	<meta name="keywords" content="幸福兄弟，幸福兄弟盐城拼购第一网，幸福兄弟拼购，幸福兄弟拼购网，盐城拼购，盐城拼购，盐城建材拼购，盐城家具拼购，盐城电器拼购，建材拼购，家具拼购，电器拼购"/>

		<meta http-equiv="pragma" content="no-cache" />
		<meta http-equiv="cache-control" content="no-cache" />
		<meta http-equiv="expires" content="0" />
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3" />
		<meta http-equiv="description" content="This is my page" />
		<link rel="Shortcut Icon" type="image/x-icon"
			href="<%=basePath%>resource/img/favicon.ico" media="screen" />
		<link href="<%=basePath%>resource/css/css3.css" rel="stylesheet"
			type="text/css" />
		<script type="text/javascript"
			src="<%=basePath%>/resource/js/My97DatePicker/WdatePicker.js"></script>
		<script type="text/javascript"
			src="<%=basePath%>/resource/js/jquery-1.4.2.js"></script>
	</head>

	<body id="top">

			<div id="top-1">
				<div class="top-1-left">
					<a href="javascript:addfavorite()" title="收藏本站">收藏本站</a>
				</div>
				<%
					String userid = "";
					String userType = "";
					TsSysuser tsSysuser = (TsSysuser) RequestUtil
							.getLoginUserFromSession(request, Contants.SESSION_USER);
					if (tsSysuser == null) {
				%>
				<div class="top-1-right">
					欢迎登录幸福兄弟拼购网！ |
					<a href="<%=basePath%>login.html" target="_top" title="登录">登录</a>
					|
					<a href="<%=basePath%>user/goForWordRegister.shtml" target="_top"
						title="免费注册">免费注册</a> |&nbsp;&nbsp;
				</div>
				<%
					} else {
						userid = tsSysuser.getId().toString();
						userType = tsSysuser.getType();
				%>
				<div class="top-1-right">
					欢迎<%=tsSysuser.getUsername()%>登录幸福兄弟拼购网！ |
					<a href="<%=basePath%>loginsuccess.jsp" target="_top" title="个人管理">个人管理</a>
					|
					<a href="<%=basePath%>user/qiantanExit.shtml" target="_top"
						title="退出登录">退出登录</a>
				</div>
				<%
					}
				%>
			</div>
			<div id="banner3">
				<img src="<%=basePath%>${tgBrand.brandPic}" width="1000" height="280" title="${tgBrand.name}" />
			</div>
			<div id="nav">
				<table width="1000" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td
							style="background: url(../resource/img/index/sh-1.jpg) no-repeat; height: 39px; width: 11px">
							&nbsp;
						</td>
						<td width="982"
							style="background: url(../resource/img/index/sh-2.jpg) repeat-x; line-height: 33px">
							<div id="nav-1">
								<a href="<%=basePath%>home.shtml">首页</a> &gt;
								<a
									href="<%=basePath%>showCategory.shtml?categoryId=${category.id}&pid=${pcategory.id}">${pcategory.name}</a>
								&gt;
								<a
									href="<%=basePath%>showCategory.shtml?categoryId=${category.id}&pid=${pcategory.id}">${category.name}</a>
								&gt;
								<a href="#">${tgBrand.name}</a>
							</div>

						</td>
						<td
							style="background: url(../resource/img/index/sh-3.jpg) no-repeat; height: 39px; width: 7px">
							&nbsp;
						</td>
					</tr>
				</table>
			</div>

			<div id="content">
				<div id="left">
					<div class="left1">
						<div class="left1-1">
							抢购必读
						</div>
						<div class="left1-2">
							<p style="color: #09C">
								${tgBrand.announcement}
							</p>


							<p style="color: #F60; font-size: 14px">
								请真实填写商家咨询了解的相关信息，如果不实而造成纠纷，后果自负。为了舒心拼购，请主动保留相关证据。
							</p>
						</div>
					</div>
					<div class="left2">
						<div class="left2-1">
							本月已有
							<span style="color: #F00; font-size: 18px; font-weight: 600">${count}</span>人参加拼购
						</div>
						<div class="left2-2">
						<form target="joinFrame" action="<%=basePath %>buyrecord/saveOrUpdate.shtml" method="post">
							<table width="310" border="0" cellspacing="0" cellpadding="0">
								<tr>
									<td align="left">
										<div class="left2-3">
											咨询电话：
											<span style="font-size: 17px; font-weight: 600">
											<s:if test='%{#tgBrand.phone == null||#tgBrand.phone == ""}'>暂无资料</s:if>
											<s:else>
												${tgBrand.phone}
											</s:else>
											</span>
										</div>
										<div class="left2-4">
											我要参加拼购
										</div>

									</td>
									<td width="80px" height="60px" align="left" valign="middle">
										<img src="<%=basePath%>resource/img/index/groupicon.gif"
											width="48" height="48" />
									</td>
								</tr>
								<tr>
									<td colspan="2">
										<table width="310" border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td width="95" align="right">
													<div class="quandianping">
														<label for="textfield">
															真实姓名：
														</label>
													</div>
												</td>
												<td align="left">
													<div class="quandianping">
														<input type="text" name="tpRecord.name" maxlength="25"
															id="username" />
														<em style="color: #F00">*</em>
													</div>
												</td>
											</tr>
											<tr>
												<td align="right">
													<div class="quandianping">
														<label for="textfield2">
															手机：
														</label>
														<input type="hidden" name="tpRecord.brandId" id="brandId" value="<s:property value="#tgBrand.id"/>" />
													</div>
												</td>
												<td align="left">
													<div class="quandianping">
														<input type="text" name="tpRecord.pho" maxlength="18"
															id="phone" />
														<em style="color: #F00">*</em>
													</div>
												</td>
											</tr>
											<tr>
												<td align="right">
													<div class="quandianping">
														<label for="textfield3">
															备用电话：
														</label>
													</div>
												</td>
												<td align="left">
													<div class="quandianping">
														<input type="text" name="tpRecord.tel" maxlength="18"
															id="tel" />
													</div>
												</td>
											</tr>
											<tr>
												<td align="right">
													<div class="quandianping">
														<label for="textfield4">
															小区名称：
														</label>
													</div>
												</td>
												<td align="left">
													<div class="quandianping">
														<input type="text" name="tpRecord.address" maxlength="50"
															id="address" />
														<em style="color: #F00">*</em>
													</div>
												</td>
											</tr>
											<tr>
												<td align="right">
													<div class="quandianping">
														<label for="select">
															参加拼购时间：
														</label>
													</div>
												</td>
												<td align="left">

													<div class="quandianping">
														<input name="tpRecord.partTime" maxlength="25" id="parttime"
															onFocus="WdatePicker({firstDayOfWeek:7,dateFmt:'yyyy-MM-dd HH:mm:ss'})"
															class="Wdate" />
														<em style="color: #F00">*</em>
													</div>
												</td>
											</tr>
											<tr>
												<td align="right">
													<div class="quandianping">
														<label for="textfield5">
															购买数量：
														</label>
													</div>
												</td>
												<td align="left">
													<div class="quandianping">
														<input type="text" name="tpRecord.buyNum" id="num"
															maxlength="5" />
														<em style="color: #F00">*</em>
													</div>
												</td>
											</tr>
											<tr>
												<td align="right">
													<div class="quandianping">
														<label for="textfield6">
															产品名称：
														</label>
													</div>
												</td>
												<td align="left">
													<div class="quandianping">
														<input type="text" name="tpRecord.proName" maxlength="100"
															id="wuname" />
													</div>
												</td>
											</tr>
											<tr>
												<td align="right">
													<div class="quandianping">
														<label for="textfield7">
															产品型号：
														</label>
													</div>
												</td>
												<td align="left">
													<div class="quandianping">
														<input type="text" name="tpRecord.model" id="type"
															maxlength="100" />
													</div>
												</td>
											</tr>
											<tr>
												<td align="right">
													<div class="quandianping">
														<label for="textfield8">
															咨询成交单价：
														</label>
													</div>
												</td>
												<td align="left">
													<div class="quandianping">
														<input type="text" name="tpRecord.price" id="xun"
															maxlength="5" />
													</div>
												</td>
											</tr>
											<tr>
												<td align="right">
													<div class="quandianping">
														<label for="textfield9">
															咨询成交总价：
														</label>
													</div>
												</td>
												<td align="left">
													<div class="quandianping">
														<input type="text" name="tpRecord.total" maxlength="5"
															id="xuntotal" />
													</div>
												</td>
											</tr>
											<tr>
												<td align="right">
													<div class="quandianping">
														<label for="textfield10">
															咨询成交折扣：
														</label>
													</div>
												</td>
												<td align="left">
													<div class="quandianping">
														<input type="text" name="tpRecord.zhekou" maxlength="4"
															id="zhekou" />
													</div>
												</td>
											</tr>
											<tr>
												<input type="hidden" name="tpRecord.categoryId" value="${tgBrand.categoryId} "
													id="categoryId" />
												<input type="hidden" value="<%=userid%>" id="userid" name="tpRecord.userId" />
												<input type="hidden" value="0" id="autding" name="tpRecord.autding" />
												<td align="right">
													<div class="quandianping">
														<label for="textfield11">
															咨询时间：
														</label>
													</div>
												</td>
												<td align="left">
													<div class="quandianping">
														<input type="text" name="tpRecord.queryDate" maxlength="25"
															id="time"
															onFocus="WdatePicker({firstDayOfWeek:7,dateFmt:'yyyy-MM-dd HH:mm:ss'})"
															class="Wdate" />
													</div>
												</td>
											</tr>
										</table>
										<table width="310" border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td
													style="padding-top: 10px; padding-left: 10px; padding-right: 10px">
													<div class="quandianping1">
														<em style="color: #F00">*</em>为了防止虚假信息、弄虚作假恶意现象的出现，影响消费者参加拼购的利益，是凡参加拼购的业主
														必须缴纳定金（200元）；购买时直接冲抵货款。
													</div>

												</td>
											</tr>
											<tr>
												<td height="30px">
													<div class="tijiao">
														<a href="javascript:add();">提交</a>
													</div>
												</td>
											</tr>
											<tr>
												<td height="10px">
													&nbsp;
												</td>
											</tr>
										</table>
									</td>
								</tr>
							</table>
							</form>
							<iframe name="joinFrame" style="display: none"></iframe>
						</div>
					</div>
					<div class="left1">
						<div class="left3-1">
							已参加
							<font
								style="font-weight: bold; padding-left: 5px; padding-right: 5px;">${tgBrand.name}</font>拼购的业主：
						</div>
						<div class="left1-2">
							<ul>
								<s:if test="%{#memberlist == null||#memberlist.size()==0}">
									<li>
										<p style="font-size: 14px; color: #036">
											暂时没有业主参与&nbsp;&nbsp;
										</p>
									</li>
								</s:if>
								<s:iterator value="#memberlist" var="member">
									<li>
										<p style="font-size: 14px; color: #036">
											<s:if test="%{#member.userId == #session.userinfo.id}">
												<s:set name="joinFlag" value="true" ></s:set>
											</s:if>
											${member.name}&nbsp;&nbsp;
											<span style="color: #F60; font-size: 14px">${member.partTime}</span>
										</p>
									</li>
								</s:iterator>
							</ul>
						</div>
					</div>
				</div>
				<div id="right">
					<script>
      
   var bid=document.getElementById("brandId").value
</script>
					<IFRAME id="test" name="test" frameBorder=0 scrolling=no
						src="../brand/brandDetail.shtml?id=${tgBrand.id}" width="100%"
						height="0"></IFRAME>
				</div>
			</div>
			<iframe src="<%=basePath%>index/footer.html" frameborder="0"
				scrolling="no" width="100%" ; height="90px;"></iframe>
	</body>
	<script>
       var basepath="<%=basePath%>";
       var  userid="<%=userid%>";
       var userType = "<%=userType%>"
       var joinFlag = '<s:property value="#joinFlag"/>';
  function add(){
  	if(userid == ''){
  		alert('您还未登录，请先登录!');
  		return;
  	}
  	if(userType != '3'){
  		alert('只有业主才可以参加拼购!');
  		return;
  	}
              var  username= $("#username").val();
              if(""== username){
                  alert("请填写真实姓名");
                   $("#username").focus();
                   return ;
              }
              var  phone= $("#phone").val();
              if(""== phone){
                  alert("请填写手机");
                 $("#phone").focus();
                  return ;
              }
              var  address= $("#address").val();  
              if(""== address){
                  alert("请填写小区名称");
                  $("#address").focus();
                  return ;
              }
              var  parttime= $("#parttime").val();  
              if(""== parttime){
                  alert("请选择参加拼购时间");
                  $("#parttime").focus();
                  return ;
              }
            
               var  num= $("#num").val();  
              if(""== num){
                  alert("请填写购买数量");
                  $("#num").focus();
                  return ;
              }else{
              	if(isNaN(num)){
              		 alert("购买数量只能为整数");
                  	 $("#num").focus();
                  	 return ;
              	}
              }
              /*  $.post(basepath+"buyrecord/saveOrUpdate.shtml?tpRecord.name="+encodeURI(encodeURI(username))+"&tpRecord.pho="+phone+"&tpRecord.brandId="+brandid+"&tpRecord.categoryId="+categoryId
               +"&tpRecord.tel="+tel+"&tpRecord.address="+encodeURI(encodeURI(address))+"&tpRecord.partTime="+parttime+"&tpRecord.buyNum="+num+"&tpRecord.proName="+encodeURI(encodeURI(proname))+"&tpRecord.model="+encodeURI(encodeURI(mode))
               +"&tpRecord.price="+xun+"&tpRecord.total="+total+"&tpRecord.zhekou="+zhekou+"&tpRecord.queryDate="+queryDate+"&tpRecord.autding=0&tpRecord.userId="+userid
               ,function(message){
				if(message == "1"){
					alert("申请成功");
			         $("#username").val("");
			         $("#phone").val("");
			         $("#address").val(""); 
			         $("#tel").val(""); 
			         $("#parttime").val("");
			         $("#num").val("");
			         $("#xun").val("");
			         $("#type").val("");
			         $("#wuname").val("");
			         $("#xuntotal").val("");
			          $("#zhekou").val("");
			         $("#time").val("");
				}else {
					alert("申请失败");
					return;
				}
			})*/
			document.forms[0].submit();
		}
		function addResult(mes){
			if(mes == "1"){
				alert("申请参加拼购成功");
				$("#username").val("");
			      $("#phone").val("");
			        $("#address").val(""); 
			         $("#tel").val(""); 
			         $("#parttime").val("");
			         $("#num").val("");
			         $("#xun").val("");
			         $("#type").val("");
			         $("#wuname").val("");
			         $("#xuntotal").val("");
			          $("#zhekou").val("");
			         $("#time").val("");
			}else{
				alert("申请参加拼购失败");
			}
		}
		function initIframeHeight(height){
			$("#test").css({height:height+'px'})
		}
</script>
</html>
<SCRIPT FOR=window EVENT=onload LANGUAGE="JScript">
document.all("test").height=test.document.body.scrollHeight;
</SCRIPT>



